package top.buluoluo.productservice.dto.result;

import lombok.Data;

import java.util.List;

@Data
public class PageResult<T> {
    private Integer pageNum;
    private Integer pageSize;
    private Integer total;
    private Integer totalPages;
    private List<T> list;

    public PageResult(int pageNum, int pageSize, int total, List<T> list) {
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.total = total;
        this.totalPages = (int) Math.ceil((double) total / pageSize);
        this.list = list;
    }
}